<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2  (Linux)">
	<META NAME="CREATED" CONTENT="20091209;18113300">
	<META NAME="CHANGEDBY" CONTENT="Αλέξανδρος Μουζακίδης">
	<META NAME="CHANGED" CONTENT="20110324;3383300">
	<META NAME="Info 1" CONTENT="">
	<META NAME="Info 2" CONTENT="">
	<META NAME="Info 3" CONTENT="">
	<META NAME="Info 4" CONTENT="">
	<STYLE TYPE="text/css">
	<!--
		@page { size: 8.5in 11in; margin: 0.79in }
		P { margin-bottom: 0.08in }
		PRE.cjk { font-family: "DejaVu Sans", monospace }
		A:link { so-language: zxx }
	-->
	</STYLE>
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=4><B>Manual of
PServer version 1.0</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">PServer is an application
that is developed from the National Center of Scientific Research
“Demokritos” of Greece and is a general purpose personalization
server. So PServer is a program with functionality that can be used
by different kind of applications that need to provide personalized
facilities.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=4><B>1.
Technical characteristics</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">PServer is designed to be
platform and application independent, that means it can run on
different operating systems and can provide generic personalization
services to application that the content is unknown. To accomplish
this tasks PServer's implementation has been done with the
programming language Java and without any usage of operating system
API and is usable under any known operating system that has a port of
Java virtual machine version 1.5+. We have tested PServer under
Linux, Windows and Solaris and works perfectly. PServer needs a RDBMS
to store its data and we have chosen MySQL (version 5+) which is a
very mature , open source and has a version for all the known
operating systems software. Furthermore to be platform independent
PServer is designed to communicate over HTTP protocol. Applications
can make simple HTTP requests that contains the parameters of the
request and gather results through XML documents. This is pretty much
the same way that RESTful web services works but it is even
“lighter”. An Example of the HTTP request is this 
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><A HREF="http://127.0.0.1:1111/pers?clnt=test">http://127.0.0.1:1111/pers?clnt=test</A>|test&amp;com=addattr&amp;testAttr=test”</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">We explain the syntax of
commands later in this document but to avoid wondering this command
requests from PServer to add a new attribute with the name testAttr
and this attribute must has a default value test. The result is this
XML document 
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<PRE CLASS="western" STYLE="text-align: justify"><A NAME="line1"></A>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;result&gt;
&lt;row&gt;&lt;num_of_rows&gt;1&lt;/num_of_rows&gt;&lt;/row&gt;
&lt;/result&gt;</PRE><P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">
It just tells that everything went well and there is a new record
into the data base.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">This design gives the
opportunity to use PServer from applications that is written for
specific operating systems with any programming language that
supports just a tcp/ip socket library and can read UTF-8 characters.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=4><B>2. User
modeling</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">The main component of
PServer is its data model because with that we have an abstract way
to express users, likes, interests and apply (data mining) algorithms
to extract information that can be useful to different kinds of
applications. This model makes PServer application independent
because we do not store any application semantics and we express
different content types with generic types. The generic types that we
use are</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><B>User</B>: is the
entity that we want to stores his/hers interests and likes</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><B>Feature</B>: is any
object the we want to express how much the user likes or he/she is
interesting about. A user can express his like and interesting about
a feature. We make this distinction because a user might be
interesting about features that does not likes at all</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><B>Attribute</B>: is any
physical characteristic that a user has, for example age is a user
attribute</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><B>User stereotype</B>:
is a group of users that have some common attributes. We use it for
collaborating filtering. A user stereotype has users that belong to
it and its profile is calculated by a mathematical formula (sum etc )
that takes input the user profiles that are part of the stereotype.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><B>User communities</B>:
is a group of users that has common likes about features.</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><B>Feature group</B>: is
a group of features that many users like concurrently</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">PServer applications can
define correlation between PServer objects like between features to
create (user based) graphs where spreading activation algorithms can
be used to infer implicit knowledge about profiles that we do not
have explicit information. 
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=4><B>3.
Database</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>Bellow
we describe the database tables of PServer's data base. In every
table there is an extra field that we do not comment at every table
because it has the same meaning. This field is </FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>FK_psclient
varchar(50) </FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>and
is used to determine the PServer client that uses this data. We
wanted PServer to be accessible by many different application
simultaneously and we had the need to define this field.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=3><B>attributes</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the user attributes</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=3><B>communities
</B></FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the the user communities</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>community_associations</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the correlations between user communities</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=3><B>community_feature_associations</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the correlations between features of the user
communities</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>community_profiles</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the likes of a community </FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>decay_data</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains logs about feature usage</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>decay_groups</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains groups of decay data. There is explanation about these
data at PServer's command manual that can be accessed through html
pages from PServer.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>num_data</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains logs of feature like values</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>ftrgroups</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the feature groups.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>ftrgroup_features</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the profile of feature groups. This is a binary array
that defines the features that belongs to feature group and the
features that don't.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>pserver_clients</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the applications that are registered to use the
PServer.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>stereotypes</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the stereotypes that are needed by an application.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>stereotype_attributes</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the attribute values that consist the stereotype.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>stereotype_profiles</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><A NAME="DDE_LINK1"></A>
<FONT SIZE=3>This table contains the likes of a the Stereotypes.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>stereotype_feature_associations</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the correlations of a the Stereotypes.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>stereotype_users</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><A NAME="DDE_LINK2"></A>
<FONT SIZE=3>This table contains the users that belongs to a
stereotype.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>up_features</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the features that are defined by the applications.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=3><B>user_associations</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the correlations of the users.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3><B>user_attributes</B>
</FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the values of user attributes.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=3><B>user_community</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the communities that users belong to.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=3><B>user_feature_associations</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><A NAME="DDE_LINK"></A>
<FONT SIZE=3>This table contains the correlations of features for a
user. If we want to describe correlations in general that is not
personalized we leave the user field of this table with the empty
string.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=3><B>user_profiles</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the likes of the users</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=3><B>user_interests</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the interests of the users</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=3><B>user_sessions</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the ids of the sessions that exist in tables
decay_data and num_data</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=3><B>users</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
table contains the users</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=4><B>4
Installation and configuration</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>As
we have said PServer is implemented in Java and users MySQL as its
RDBMS. That means that if you want to install PServer first you must
have to install MySQL version 5+ and JVM version 1.5+. You can
download these applications from the sites of MySQL and Sun for free.
After the installation you must create a database for PServer and
import the PServer's database script into MySql to construct the
database. If you have a MySQL user with the name pserver and you have
created a database with the name pserver then the command</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>mysql
-u pserver -p pserver &lt; pserver_db.sql </FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
will import the database script. After this you must configure
PServer through the server.ini file that exists inside the root
directory of PServer. Server.ini contains the following properties.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>database_user=pserver</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
parameter defines the user that is used by the PServer to connect to
database</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>database_driver=com.mysql.jdbc.Driver</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
parameters defines the jdbc driver that will be used to connect to
database. </FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>port=1111</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
is the TCP port that PServer will bind to listen for requests.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>ssl=off</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
parameters defines if the communication will be done by secure shell
mode.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>read_request_timeout=5000</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
parameters defines the maximum time in milliseconds that PServer will
keep a connection open waiting for a request</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>main_html_dir=./public</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>Pserver
is a simple HTTP server and can serve files. This parameter defines
the directory that contains</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>def_html_file=index.html</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
parameter contains the default name of the HTML file that PServer
serves from its web content directory.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>database_url=mysql\://127.0.0.1/pserver</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
parameter defines the jdbc URL that is used to connect to database</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>log_mode=on</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
parameter defines if it will be stored a log into a file</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>database_pass=kabamaru</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
parameter defines the password for RDBMS user that is used to connect
to database</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>debug_mode=on</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
parameter defines if we want to log extra debug messages from the
PServer</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>max_requests=50</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
parameter defines the maximum requests that can be accepted
concurrently.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>max_log_size=50000000</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
parameter defines the maximum log file size in bytes</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>log_file_path=./server.log</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
parameter defines the file that log will be stored</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>thread_num=5</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
parameter defines the maximum threads that can use PServer to execute
processing. PServer might has to process a great amount of data and
this takes time. We use threads for parallel processing to to speed
up the server responses. These days every CPU has more than one cores
and you have to parameterize PServer to use these cores. For an Intel
Core 2 duo our experiments has shown that the performance is
increased until 4 threads and for a Intel Core 2 quad until 5
threads. An I7 CPU has greater scaling but we do not have determine
its limit yet.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>If
PServer has started properly you can change the above properties
though the administration interface. Just open a browser type the
HTTP URL that directs to PServer and you will see an image bellow.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><IMG SRC="pserver_manual_html_m6e9c3cad.png" NAME="graphics1" ALIGN=LEFT WIDTH=665 HEIGHT=349 BORDER=0><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>The
menu that exists at the left side of the screen has the
administration options like help, change properties and manage
PServer clients. The most important thing the last one because you
need it to register you application to has access to make requests.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><IMG SRC="pserver_manual_html_mf25a232.png" NAME="graphics2" ALIGN=LEFT WIDTH=665 HEIGHT=349 BORDER=0><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>To
register your applications just type a name that you want and give
two times a desirable password. You must remember your password
because it is kept encrypted into the database and can not be
recovered.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>Another
important file is the pbeans.ini that contains definitions of Java
objects that PServer must load on startup and their name that is used
by the server. For example </FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>pers=pserver.pservlets.Personal()</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>ster=pserver.pservlets.Stereotypes()</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>commu=pserver.pservlets.Communities()</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>admin=pserver.pservlets.Admin(admin,root,root)</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>csv=pserver.pservlets.Csv()</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>cos=pserver.algorithms.metrics.CosineVectorMetric();</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>ps=pserver.algorithms.metrics.PearsonCorrelationMetric();</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>bk=pserver.algorithms.graphs.BK();</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>This
tells the PServer to load objects of different classes (pbeans) that
pserver will put into hash maps and can share their functionality
through Java reflection. We will explain how to write pbeans and use
them later for now just remember that any plug-in that you want to
insert and use must be defined in this file with a unique name. The
definition is done by typing a name the operator of equality and a
class name. The parenthesis after the class name defines the pbean
initialization parameters. The preinstalled pbean admin contains the
functionality for the administration interface of PServer that we
have shown before. It takes three parameters first the name that is
defined into pbeans.ini, the login name (the first root) and the
login password that user must type to make a successful log in. When
you want to use the administration tool you have to provide these two
words to gain access. If you want to change these words just make the
changes here, save the file and make a restart of the PServer.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=4><B>5. Make
PServer requests</B></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>To
make requests to PServer you must write a program that can open TCP
sockets, write a HTTP request and knows how to parse XML documents.
If you have a Java application you can use our class PSClientRequest
that comes with the PServer package and does these things. If you
don't you can read the code and make a port of this simple class for
the language that you are using. </FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>PServer
is an HTTP application server that runs plug-ins (pservlet pbeans)
that serves the requests and returns responses. Based on this logic
the requests that you make to PServer has specific structure </FONT>
</P>
<PRE CLASS="western" STYLE="text-align: justify"> 
<FONT SIZE=3>http://url/&lt;pbean_name&gt;?clnt=name|pass&amp;com=some_com&amp;param1=val1&amp;param2=val2...</FONT></PRE><P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal">
<FONT SIZE=3>first you define the URL that links to PServer, then the
pservlet that you want to use and then the client name/pass that
makes the request and the pservlet parameters. Every pservlet defines
its own parameters. The pservlets that we have written has a common
structure, they need to get a com parameter that defines the pservler
command that needs to be called and then the parameters of the
specified commands. pservlets can return any type of document
(HTML,XML,JSON etc) but the ones that we have implemented and we use
return XML. The admin pservlet is an exception, it returns HTML
documents and this is needed to access it through a web browser. The
XML that is returned is always structured like a 2d array. You can
see the structure by reading the xsl files that we provide with
PServer and exist in the resp_xsl folder inside the public folder.
For example we are printing one of these </FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;?xml
version=&quot;1.0&quot;?&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;xsl:stylesheet
xmlns:xsl=&quot;http://www.w3.org/TR/WD-xsl&quot;&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;xsl:template
match=&quot;/&quot;&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;html&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;head&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;title&gt;View
from Table: up_features&lt;/title&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;/head&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;body&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;br&gt;&lt;/br&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;h2&gt;features
and default values&lt;/h2&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;p&gt;&lt;/p&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;b&gt;Tables:&lt;/b&gt;
up_features</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;br&gt;&lt;/br&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;b&gt;Description:&lt;/b&gt;
A selection of (feature, default value) pairs.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;p&gt;&lt;/p&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;table
border=&quot;1&quot; cellpadding=&quot;4&quot;&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;xsl:for-each
select=&quot;result/row&quot;&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;tr&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;th&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;xsl:value-of
select=&quot;ftr&quot;/&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;/th&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;td&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;xsl:value-of
select=&quot;defval&quot;/&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;/td&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;/tr&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;/xsl:for-each&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;/table&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;br&gt;&lt;/br&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;a
href=&quot;/&quot;&gt;Back to home&lt;/a&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;p&gt;&lt;/p&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;/body&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;/html&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;/xsl:template&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>these
xsl files are used to provide formated output to web browsers. Type
commands into a web browser (like Konqueror) and you will get results
that sows the 2d arrays philosophy</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>Here
is the XML document from the execution of the command</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=3><SPAN STYLE="font-weight: normal"><A HREF="http://127.0.0.1:1111/pers?clnt=test1">http://127.0.0.1:1111/pers?clnt=test1</A>|test1&amp;com=getusrs&amp;whr=*</SPAN></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;?xml
version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;?xml-stylesheet
type=&quot;text/xsl&quot; href=&quot;/resp_xsl/user.xsl&quot;?&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;result&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;row&gt;&lt;usr&gt;1&lt;/usr&gt;&lt;/row&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;row&gt;&lt;usr&gt;10&lt;/usr&gt;&lt;/row&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;row&gt;&lt;usr&gt;100&lt;/usr&gt;&lt;/row&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">…<FONT SIZE=3><SPAN STYLE="font-weight: normal">.</SPAN></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;row&gt;&lt;usr&gt;194&lt;/usr&gt;&lt;/row&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;row&gt;&lt;usr&gt;195&lt;/usr&gt;&lt;/row&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;row&gt;&lt;usr&gt;196&lt;/usr&gt;&lt;/row&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;row&gt;&lt;usr&gt;197&lt;/usr&gt;&lt;/row&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;row&gt;&lt;usr&gt;198&lt;/usr&gt;&lt;/row&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;row&gt;&lt;usr&gt;199&lt;/usr&gt;&lt;/row&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;row&gt;&lt;usr&gt;2&lt;/usr&gt;&lt;/row&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>&lt;/result&gt;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>Inside
the public folder of PServer there are subdirectories that contains
help about every implemented pservlet and its API.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>To
make this call and print the results with the PSClientRequest Java
class you will need the code bellow</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><A NAME="DDE_LINK4"></A>
<FONT SIZE=3>PSClientRequest request = new PSClientRequest(
InetAddress.getLocalHost(), 1111, command, true, 10000 );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>for(
int i = 0 ; i &lt; request.getRows() ; i ++ ) {</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>System.out.println(
request.getValue( i, 0 ));</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>}</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>There
is full documentation about the methods that PSClientRequest provides
at the Java docs that are bundle with the PServer</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><FONT SIZE=4><B>6.
Implement a PServlet </B></FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>To
implement your own pservlet you must create a Java class implement
the pserver.pservlets.PService interface. This interface has the
following methods</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>public
abstract String getMimeType();</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
method returs the MIME type of the document that your pservlet
returns. For example text/xml if you want to return XML documents.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>public
abstract void init( String[] params ) throws Exception;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>this
method will be called when the PServlet will be loaded</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>public
abstract int service( VectorMap parameters, StringBuffer response,
DBAccess dbAccess );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>the
method contains the functionality that pservlet profide. It gets the
request parameters into a VevtorMap, the response object will contain
the returned document after the execution of the pservlet and
dbAccess is an object that provides access to PServer database.</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>A
typical pservlet implementation will looks like this </FONT>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>public
class SomeServlet implements pserver.pservlets.PService {</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>public
void init( String[] params ) throws Exception {</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>}</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>public
String getMimeType() {</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>return
pserver.pservlets.PService.xml;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>}</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>public
int service( VectorMap parameters, StringBuffer response, DBAccess
dbAccess ) {</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>int
respCode;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>VectorMap
queryParam;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>StringBuffer
respBody;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>respBody
= new StringBuffer();</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>queryParam
= parameters;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>//removes
the password from the clnt parameter, the validation has been done by
PServer before this statement</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>int
clntIdx = queryParam.qpIndexOfKeyNoCase( &quot;clnt&quot; );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>String
clientName = (String) queryParam.getVal( clntIdx );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>clientName
= clientName.substring( 0, clientName.indexOf( '|' ) );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>queryParam.updateVal(
clientName, clntIdx );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>int
comIdx = parameters.qpIndexOfKeyNoCase( &quot;com&quot; );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>if
( comIdx == -1 ) {</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>respCode
= PSReqWorker.REQUEST_ERR;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>WebServer.win.log.error(
&quot;-Request command does not exist&quot; );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>return
respCode; //no point in proceeding</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>}</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>//recognize
command encoded in request</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>String
com = (String) queryParam.getVal( comIdx );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>if
( com.equalsIgnoreCase( &quot;someCommand&quot; ) ) {//calculetes
user distances</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>respCode
= comSomeCommand( queryParam, respBody, dbAccess );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>}
else if ( com.equalsIgnoreCase( &quot;calcftrdist&quot; ) )
{//calculetes feature distances</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>else
{</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>respCode
= PSReqWorker.REQUEST_ERR;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>WebServer.win.log.error(
&quot;-Request command not recognized&quot; );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>}</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>response.append(
respBody.toString() );</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>return
respCode;</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>}</FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in">…<FONT SIZE=3><SPAN STYLE="font-weight: normal">.</SPAN></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0in; font-weight: normal"><FONT SIZE=3>}</FONT></P>
</BODY>
</HTML>